#!/usr/bin/env python

""" Unit tests for Google Finance Lookup
"""

import unittest
import sys
sys.path.append("..")
import gfparser


class TestGFParser(unittest.TestCase):
  knownValues = ( ('stocks','80.15%'),
                  ('bonds','16.20%'),
                  ('cash','3.18%'),
                  ('convertible','0.01%'),
                  ('other','0.45%'))
    
  def testLookupAllocation(self):
    """Lookup asset allocation values"""
    fund = GFinanceLookup("AROIX")
    
    for asset, percent in self.knownValues:
      value = fund.getAllocation(asset)
      self.assertEqual(percent,value)
    

if __name__ == "__main__":                   
    unittest.main()

